/*
文件编码：UTF8
题目：合工大OJ1348多重部分和
类型：多重背包的可行性问题
编写人：wei
编写时间：2016-5-19
*/

#include<iostream>
#include<cstring>

using namespace std;

int t,n,k;
int ni[100001],mi[100001];
int f[100001];

int main(void)
{
	cin>>t;
	for (int i1 = 0; i1 < t; ++i1)
	{
		/* code */
		cin >> n;
		memset(ni,0,sizeof(int)*100001);
		memset(mi,0,sizeof(int)*100001);
		memset(f,-1,sizeof(int)*100001);
		for (int i2 = 1; i2 <= n; ++i2)
		{
			/* code */
			cin >> ni[i2];
		}
		for (int i2 = 1; i2 <= n; ++i2)
		{
			/* code */
			cin >> mi[i2];
		}
		f[0]=0;
		cin >> k;
		for (int i2 = 1; i2 <= n; ++i2)
		{
			/* code */
			for (int i3 = 0; i3 <= k; ++i3)
			{
				/* code */
				if(f[i3] >= 0)
					f[i3] = mi[i2];
				else
					f[i3] = -1;
			}
			for (int i3 = 0; i3 <= k-ni[i2]; ++i3)
			{
				/* code */
				if(f[i3]>0)
				{
					if(f[i3+ni[i2]]<f[i3]-1)
						f[i3+ni[i2]]=f[i3]-1;
				}
			}
		}
		if(f[k]>=0)  cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}